(gethomedir): Look at LOGNAME before USER.
authorKarl Heuer <kwzh@gnu.org>
Sat, 12 Feb 1994 00:12:15 +0000 (00:12 +0000)
committerKarl Heuer <kwzh@gnu.org>
Sat, 12 Feb 1994 00:12:15 +0000 (00:12 +0000)
src/xrdb.c

index 112badf3629e0bf5c18f1ffe6f1078c46ac08a22..9ab9f87e9151a5e012e3d896c61715a73af70863 100644 (file)
@@ -288,20 +288,17 @@ magic_file_p (string, string_len, class, escaped_suffix, suffix)
 static char *
 gethomedir ()
 {
-  int uid;
   struct passwd *pw;
   char *ptr;
   char *copy;
 
   if ((ptr = getenv ("HOME")) == NULL)
     {
-      if ((ptr = getenv ("USER")) != NULL)
+      if ((ptr = getenv ("LOGNAME")) != NULL
+         || (ptr = getenv ("USER")) != NULL)
        pw = getpwnam (ptr);
       else
-       {
-         uid = getuid ();
-         pw = getpwuid (uid);
-       }
+       pw = getpwuid (getuid ());
 
       if (pw)
        ptr = pw->pw_dir;